package com.ahao.sdk.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferencesUtils {
    final static String name = "AHaoSDK.xml";
    final static String prix = "AHaoSDK_";
    public static void setToken(Context context, String token){
        setSharedPreferencesString(context, "token", token);
    }

    public static String getToken(Context context){
        return getSharedPreferencesString(context,"token");
    }

    public static String getSharedPreferencesString(Context context, String name){
        return getSharedPreferences(context).getString(name, "");
    }
    public static void setSharedPreferencesString(Context context, String name, String value){
        getSharedPreferences(context).edit().putString(name, value).apply();
    }
    private static SharedPreferences getSharedPreferences(Context context){
        return context.getSharedPreferences(prix + name, Context.MODE_PRIVATE);
    }
}
